package com.jinmdz.fmis.dao.dao;

import com.jinmdz.fmis.dao.model.recactualitem.RecActualItem;
import com.jinmdz.fmis.dao.model.service.ServiceItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;

/**
 * @author zhanglr
 * @date 2020/6/12 15:43
 */
public interface RecSelItemDao {

    /**
     * 获取已选择随车物品列表
     *
     * @param recId
     * @return
     * @author ZhangLiRui
     * @date 2020-6-12 15:46
     */
    @Select("select sel.id,sel.service_item_id, item.item_code,item.item_name,item.item_name_abbr,item.item_price,item.item_number ,item.item_unit,item.item_describe ,\n" +
            "item.as_goods,item.as_package,item.as_fix_price,item.disable_state,item.sort,sel.version from rec_sel_item sel left join service_item item on sel.service_item_id = item.id where sel.rec_id = #{recId}")
    ArrayList<ServiceItem> recSelItemListByRecId(@Param(value = "recId") Integer recId);

    /**
     * 获取实际使用的物品
     *
     * @param recCode
     * @return
     * @author ZhangLiRui
     * @date 2020-6-12 17:01
     */
    @Select("select actual.id,actual.service_item_id, item.item_code,item.item_name,item.item_name_abbr,item.item_price,item.item_number ,item.item_unit,item.item_describe ,\n" +
            "item.as_goods,item.as_package,item.as_fix_price,item.disable_state,item.sort,actual.version from rec_actual_item actual left join service_item item on actual.service_item_id = item.id where actual.rec_code = #{recCode}")
    ArrayList<ServiceItem> recActualItemListByRecCode(@Param(value = "recCode") String recCode);

    /**
     * 获取实际使用的物品
     *
     * @param recCode
     * @return
     * @author GaoXiangLiang
     * @date 2020-6-12 17:01
     */
    @Select("select actual.id,actual.service_item_id, item.item_code,item.item_name,item.item_name_abbr,item.item_price,item.item_number ,item.item_unit,item.item_describe ,\n" +
            "item.as_goods,item.as_package,item.as_fix_price,item.disable_state,item.sort,actual.version from rec_actual_item actual left join service_item item on actual.service_item_id = item.id where actual.rec_code = #{recCode}")
    ArrayList<RecActualItem> recActualItemListWithRecCode(@Param(value = "recCode") String recCode);


    /**
     * 通过接运主键获得实际使用的物品
     *
     * @param recId
     * @return
     * @author GaoXiangLiang
     * @date 2020-6-12 17:01
     */
    @Select("select actual.id,actual.service_item_id, item.item_code,item.item_name,item.item_name_abbr,item.item_price,item.item_number ,item.item_unit,item.item_describe ," +
            "item.as_goods,item.as_package,item.as_fix_price,item.disable_state,item.sort,actual.version from rec_actual_item actual left join service_item item on actual.service_item_id = item.id where actual.rec_id = #{recId}")
    ArrayList<RecActualItem> recActualItemListByRecId(@Param(value = "recId") Integer recId);


}
